import tkinter as tk

root = tk.Tk()
root.geometry('500x300+350+250')
root.title('复选框')
label_frame = tk.LabelFrame(root, text='兴趣爱好')
label_frame.grid()
a = ['打篮球','踢足球','打毛球']
c = tk.IntVar()
v = [1,2,3]
for i in range(len(a)):
    tk.Radiobutton(label_frame,text=a[i],variable=c,value=v[i],justify='left').grid(row=i,column=0)


def check():

    for i in range(len(a)):
        if c.get()==v[i]:
            t=a[i]
        else:
            t=''
    user = {
        'hobby':t
    }
    print(user)
tijiao = tk.Button(root,text='提交',command=check)
tijiao.grid()



root.mainloop()